package test;

/**
 * 定容栈
 *
 * @author quanlinlin on 2018/10/23 22:46.
 * @version 1.0
 */
public class FixedCapacityStackOfStrings {

    private String[] stack;
    private int      N;

    public FixedCapacityStackOfStrings(int cap) {
        stack = new String[cap];
    }


    public String pop() {
        return stack[--N];
    }

    public boolean isEmpty() {
        return N == 0;
    }

    public int size() {
        return N;
    }

    public void push(String s) {
        stack[N++] = s;
    }
}
